<%@ include file="../includes/topInclude.jsp" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>

<script type="text/javascript" src="js/userScript.js" ></script>
<!-- Support for Spring errors object -->
<spring:bind path="groupForm.*">
  <c:forEach var="error" items="${status.errorMessages}">
    <B><FONT color=RED>
      <BR><c:out value="${error}"/>
    </FONT></B>
  </c:forEach>
</spring:bind>


<div id="content">
    <div class="post">
        <div class="title">
            <h2>Group Form</h2>
            <p></p>
        </div>
        <div class="entry">                  
            <form name="groupFormHtml" action="<c:url value="groupManagment.htm"/>" method="post">
                <table>
                    <tr>
                        <td>Group Name</td>
                        <td>         
                            <spring:bind path="groupForm.group.groupName">
                                <input type="text" name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>"/>
                            </spring:bind>            
                        </td>
                    </tr>    
                    <tr>
                        <td>Group Description</td>
                        <td>
                            <spring:bind path="groupForm.group.groupDescription">
                                <input type="text" name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>"/>
                            </spring:bind>
                        </td>
                    </tr>    
                    <tr>
                        <td colspan="2" align="right"> <input type="submit" value="Save" /></td>
                    </tr>
                </table>
                <spring:bind path="groupForm.group.id">
                    <input type="hidden" name="<c:out value="${status.expression}"/>" value="<c:out value="${status.value}"/>"/>
                </spring:bind>
                
                <input type="hidden" name="groupAction" value="" />
            </form>
        </div>
        <br/>
        <p class="links"> <a href="#" class="more">My Groups</a>  </p>        
        <table>
            <tr>
                <th>Group Name</th>
                <th>Group Description</th>        
            </tr>    
            <c:forEach var="group" items="${groupList}" >
                <tr>
                    <td><a href="<c:url value="groupManagment.htm"><c:param name="groupAction" value="${group.id}"/></c:url>"><c:out value="${group.groupName}"/></a></td>
                    <td><c:out value="${group.groupDescription}"/></td>                           
                    <td><small><a href="#" onClick="javascript:deleteGroup(<c:out value="${group.id}"/>);"> Delete </a></small></td>    
                    <td><small><a href="<c:url value="viewContacts.htm"><c:param name="groupAction" value="${group.id}"/></c:url>">Ver Contactos</a></small></td>
                </tr>   
            </c:forEach> 
        </table>
    </div>
</div>
<%@ include file="../includes/bottomInclude.jsp" %>
    